﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    public class BeginStock
    {
            public long ID {get;set;}
            [Description("Số phiếu")]
            public string BeginStockNo {get;set;}
            [Description("Ngày lập")]
            public DateTime BeginStockDate {get;set;}
            public long StaffID {get;set;}
            public long WarehouseID {get;set;}
            public string Note {get;set;}
         
        public BeginStock()
        {       
                            BeginStockNo ="";   
                            Note ="";   
        }
        
       static BeginStock DynamicCast<T>(object row_data, object row_header) where T : BeginStock
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           BeginStock ret = new BeginStock();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "BeginStockNo":
                        ret.BeginStockNo = ConvertObject.ToString(dt[column]);
                       break;
                      case  "BeginStockDate":
                        ret.BeginStockDate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StaffID":
                        ret.StaffID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "WarehouseID":
                        ret.WarehouseID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Note":
                        ret.Note = ConvertObject.ToString(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
